//
// Created by y-qin15 on 16-9-25.
//

#ifndef AI9_LOGIC_2017_UI_LOGIC_INTERFACE_H
#define AI9_LOGIC_2017_UI_LOGIC_INTERFACE_H
#include <vector>
#include <string>
#include "LogicExecutor.h"
class Operation;//单一逻辑操作
class Game;//计算逻辑
class Commands;
class PlayerInfo;
class PPlayerInfo;

class UI_Logic_Interface {
public:
    static UI_Logic_Interface* getInstance ();

    //int winnerPlayer;//-1没有胜利者 -2平局 >=0胜利玩家编号
    std::unique_ptr<LogicExecutor> logicExecutor;//后台逻辑结算
    //Commands storedCommand;

    void addActMaker(const std::string& filename,int playerId);//将文件加入到DLL列表
    void invokeAI();
    Commands getPlayerCommand(int playerId);
    void sendCommand(Commands pCommand);
    void pushInfo(const std::string& info, int playerId);

    void init();
    void run();//将logicperations指令交由logic(Game)执行一回合，并将执行结果需要播放显示的部分存放于replay_data
    std::string getReplay();
    std::string getReplayOneturn();
    int checkWin();//强制通过逻辑判定一个胜利方
    void addFeedbackActMaker(const std::string& filename, int playerId);
    void pushInfoFeedback(const std::string& info, int playerId);
    void invokeFeedback();
    std::string fetchShowinfo();
    int checkWinnerFinal();
private:
    //static UI_Logic_Interface* instance;
    explicit UI_Logic_Interface();
};


#endif //AI9_LOGIC_2017_UI_LOGIC_INTERFACE_H